<!DOCTYPE html>
<html>
  <head>
    <title>增加用户</title>
	
    <meta name="keywords" content="keyword1,keyword2,keyword3">
    <meta name="description" content="this is my page">
    <meta name="content-type" content="text/html; charset=UTF-8">
    
    <!--<link rel="stylesheet" type="text/css" href="./styles.css">-->
	<style type="text/css">
		
		.main{
			margin:300px 400px; 
		}
		
		.sp1{
			width:400px;
		}
		
		button{
		width:100px;
		height:30px;
		margin 20px auto;
		border-radius:5px;
		border:none;
		background:#FDECAA;
		font-family:'microsoft yahei';
		color:#0e0e0e;
		}
		
		a{
		color:#0e0e0e;
		text-decoration:none;
		}
	</style>
  </head>
  
  <body>
  <center>
  <div class="main">
    <span class="sp1">姓名：</span>
    <input type="text" id="name"><br/><br/>
    <span class="sp1">性别：</span> 
    <select id="sex">
    <option>男</option>
    <option>女</option>
    </select>
    <br/><br/>
    <span class="sp1">住址：</span>
    <input type="text" id="address"><br/><br/>
    <span class="sp1">联系电话：</span>
    <input type="text" id="phone"><br/><br/>
    <span class="sp1">电子邮件：</span>
    <input type="text" id="email"><br/><br/>
	&nbsp;&nbsp;&nbsp;&nbsp;<button type="button" onclick="add()">确定</button>
	&nbsp;&nbsp;&nbsp;<button type="button" ><a href="${path}/index/index">返回</button>
  </div>
  </center>
  
  <script type="text/javascript" src="${path}/js/jquery.min.js"></script>
  
  <script>
   function add(){
            
            var name =	document.getElementById("name").value;
            var sex =	document.getElementById("sex").value;
            var address =	document.getElementById("address").value;
            var phone =	document.getElementById("phone").value;
            var email =	document.getElementById("email").value;
          
            $.ajax({
          	  		type:"post",
                    url:'${path}/user/index',
                    datatype:"json",
                    data:{
                            name:name,
                            sex:sex,
                            address:address,
                            phone:phone,
                            email:email,
                    },
                   success:function(data){
                   alert("注册信息不符合标准。");
                  	 alert(data);
           			 },error:function(data){
    				 alert("注册成功。");
    				 window.location.href="${path}/index/index";
           			 
           			 }
            });
                    }
  </script>
   </body>
</html>
